{include file=buyer.header.html}
<script type="text/javascript">
function orderHover(o){
	$(o).addClass('order-hover');
}
function orderOut(o){
	$(o).removeClass('order-hover');
}
</script>
<div class="content f-cb">
	{include file=path.html}
  	{include file=member.menu.buyer.html}
	<!-- 内容右边栏 -->
	<div class="con-r-global">
		<ul id="con-order-nav" class="con-order-nav f-cb">
			<li class="nav-li">
				<a href="index.php?app=buyer_order&type=all_orders" class="{if $gets['type'] eq 'all_orders'}current{/if}">全部订单</a>
			</li>
			<li class="nav-li">
				<a href="index.php?app=buyer_order&type=pending" class="{if $gets['type'] eq 'pending'}current{/if}">待付款</a>
				{if $buyer_stat.submitted>0}
				<span class="nav-note f-cb"> <i>{$buyer_stat.submitted}</i>
				</span>
				{/if}
			</li>
			<li class="nav-li">
				<a href="index.php?app=buyer_order&type=accepted" class="{if $gets['type'] eq 'accepted'}current{/if}">待发货</a>
				{if $buyer_stat.accepted>0}
				<span class="nav-note f-cb"> <i>{$buyer_stat.accepted}</i>
				</span>
				{/if}
			</li>
			<li class="nav-li">
				<a href="index.php?app=buyer_order&type=shipped" class="{if $gets['type'] eq 'shipped'}current{/if}">待确认收货</a>
				{if $buyer_stat.shipped>0}
				<span class="nav-note f-cb">
					<i>{$buyer_stat.shipped}</i>
				</span>
				{/if}
			</li>
			<li>
				<a href="index.php?app=buyer_returns">退款退货中</a>
                {if $buyer_stat.returns>0}
				<span class="nav-note f-cb">
					<i>{$buyer_stat.returns}</i>
				</span>
				{/if}
			</li>
			<li>
				<a href="index.php?app=buyer_order&type=evalua" class="{if $gets['type'] eq 'evalua'}current{/if}">待评价</a>
				{if $buyer_stat.evalua>0}
				<span class="nav-note f-cb">
					<i>{$buyer_stat.evalua}</i>
				</span>
				{/if}
			</li>
			<li>
				<a href="index.php?app=buyer_order&type=finished" class="{if $gets['type'] eq 'finished'}current{/if}">交易成功</a>
				{if $buyer_stat.finished>0}
				<span class="nav-note f-cb">
					<i>{$buyer_stat.finished}</i>
				</span>
				{/if}
			</li>
			<li>
				<a href="index.php?app=buyer_order&type=canceled" class="{if $gets['type'] eq 'canceled'}current{/if}">交易关闭</a>
				{if $buyer_stat.canceled>0}
				<span class="nav-note f-cb">
					<i>{$buyer_stat.canceled}</i>
				</span>
				{/if}
			</li>
		</ul>
        <div class="order-search f-cb">
        <form method="get">
             <div class="order-search-left">
                <input type="hidden" name="app" value="buyer_order" />
                <input type="hidden" name="act" value="index" />
                <p><span>卖家：<input class="queryInput b-radius width8" placeholder="店铺名" type="text" name="search_name" value="{$query.search_name|escape}" /></span><span>订单编号：<input class="queryInput b-radius width8" placeholder="订单号" type="text" name="order_sn" value="{$query.order_sn}" /></span><span>商品名称：<input class="queryInput b-radius width8" placeholder="商品名称/货号" type="text" name="goods_name" value="{$query.goods_name|escape}" /></span></p>
                <p><span>下单时间：从 <input class="queryInput width2 b-radius pick_date" type="text" value="{$query.add_time_from_date}" id="add_time_from_date" name="add_time_from_date"  />
                到: <input class="queryInput width2  b-radius  pick_date" type="text" value="{$query.add_time_to_date}" id="add_time_to_date" name="add_time_to_date"  />
                </span>
                <span>订单状态：<select class="querySelect b-radius" name="status">
                    <option value="">全部</option>
                    {html_options options=$order_status_list selected=$query.status}
                </select>
                </span>
                <span>评价状态：<select class="querySelect b-radius" name="evaluation_status">
                    <option value="">全部</option>
                    {html_options options=$evaluation_status_list selected=$query.evaluation_status}
                </select>
                </span></p>
            </div>
            <div class="order-search-right"><input type="submit" class="subbtn" value="搜索" /></div>
        </form>
        </div>
		<!--{if $orders}-->

		<table class="order-show-title" width="100%">
			<tr>
				<th width="285">商品信息</th>
				<th width="120" class="order-th">商品规格</th>
				<th width="70" class="order-th">单价（元）</th>
				<th width="60" class="order-th">数量</th>
				<th width="120" class="order-th">实付总额(元)</th>
				<th width="90" class="order-th">订单状态</th>
				<th class="order-th">订单操作</th>
			</tr>
		</table>
		<!--{/if}-->

		<!-- 循环开始 -->
		<!--{foreach from=$orders item=order}-->
		<table class="order-show-each" width="100%" onmousemove="orderHover(this)" onmouseout="orderOut(this)">
			<tr>
				<td colspan="8" class="title">
					<ol class="f-cb">
						<li>订单号：{$order.order_sn}</li>
						<li>时间：{$order.add_time|date:Y-m-d H:i}</li>
						<li>
							卖家：
							<a target="_blank" href="{jsurl app=store&id=$order.seller_id}">{$order.seller_name|escape}</a>
						</li>
						<li>
							<!--{if $order.member_info.im_qq}-->
							<a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin={$order.member_info.im_qq}&site=qq&menu=yes">
								<img src="{res file=images/member/qq.jpg}" alt="" />
							</a>
							<!--{/if}-->
							&nbsp;&nbsp;
							<!--{if $order.member_info.im_aliww}-->
							<a target="_blank" href="http://www.taobao.com/webww/ww.php?ver=3&touid={$order.member_info.im_aliww}&siteid=cntaobao&status=1&charset=utf-8">
								<img src="{res file=images/member/wangwang.jpg}" alt="" />
							</a>
							<!--{/if}-->
						</li>
					</ol>
				</td>
			</tr>
			<!--{foreach from=$order.order_goods key=k item=v}-->
			<tr>
				<td width="105" valign="top">
					<div class="goods-show-img">
						<a href="{jsurl app=goods&id=$v.goods_id}" target="_blank">
							<img src="{$v.goods_image}" alt="" width="100" height="100" />
						</a>
					</div>
				</td>
				<td width="160" valign="top">
					<p>
						<a href="{jsurl app=goods&id=$v.goods_id}" target="_blank" class="linkbtn">{$v.goods_name}</a>
					</p>
					<p>货号：{$v.sku|escape}</p>
				</td>
				<td width="120" valign="top" class="order-th">
					<p>{$v.specification}</p>
				</td>
				<td width="70" valign="top" class="order-th">
					<p>{$v.price|price}</p>
				</td>
				<td width="60" valign="top" class="order-th">
					<p>{$v.quantity}</p>
				</td>
				<!--{if $order.index eq $k}-->
				<td width="120" valign="top" class="order-th">
					<dl>
                                                {if $order.old_order_amount gt 0}<dt><strike>{$order.old_order_amount|price}</strike></dt>{/if}
						<dt>{$order.order_amount|price}</dt>
                                                <!--{if $order.is_mobile}--><dd class="mobile-icon"></dd><!--{/if}-->
					</dl>
				</td>
				<td width="120" valign="top" class="order-th">
					<dl>
						<dt>
							{$order.status|modifier:order_status}
							<!--{if $order.evaluation_status eq 1}-->
							&nbsp;{$lang.already_evaluate}
							<!--{/if}-->
						</dt>
						<!--dd>货款已到万菱账户担保中</dd-->
					<dd>
						<a href="index.php?app=buyer_order&act=view&order_id={$v.order_id}" target="_blank" class="linkbtn">订单详情</a>
					</dd>
                    <!--{if $order.shipping_code and $order.ship_time gt 0}-->
                    <dd><a target="_blank" href="{url app=check_shipping&com=$order.shipping_code&nu=$order.invoice_no&type=1}" expressid="{$order.shipping_code}" expressno="{$order.invoice_no}" expresstype="1" class="linkbtn check_shipping">查看物流</a></dd>
                    <!--{/if}-->
				</dl>
			</td>
			<!--{if $order.status eq 30}-->
			<td valign="top" align="center" class="order-th">
				<ul>
					<li>
                                                <a target="_blank" href="index.php?app=buyer_order&act=view&order_id={$v.order_id}&pop=1" class="subbtnhs btn1" class="btn1" id="order{$order.order_id}_action_confirm"{if $order.status neq ORDER_SHIPPED or $order.payment_code eq 'cod'} style="display:none"{/if}>确认收货</a>
					</li>
					<li>
						<a href="{url app=buyer_returns&order_sn=$order.order_sn}" target="_blank" class="linkbtn">申请退款/退货</a>
					</li>
				</ul>
			</td>
			<!--{elseif $order.status eq 11}-->
			<td valign="top" align="center">
				<ul>
					<li>
						<a href="{carturl app=cashier&order_id=$order.order_id}" target="_blank" id="order{$order.order_id}_action_pay"{if $order.status neq ORDER_PENDING} style="display:none"{/if} class="subbtnhs btn1 btn">马上付款</a>
					</li>
					<li>
						<a href="{carturl app=cashier&order_id=$order.order_id}" ectype="dialog" dialog_width="400" dialog_title="{$lang.cancel_order}" dialog_id="buyer_order_cancel_order" uri="index.php?app=buyer_order&amp;act=cancel_order&order_id={$order.order_id}&ajax"  id="order{$order.order_id}_action_cancel"{if $order.status neq ORDER_PENDING and $order.status neq ORDER_SUBMITTED} style="display:none"{/if} class="linkbtn">取消订单</a>
					</li>
					<!--li><a href="" class="linkbtn">备忘</a></li-->
				</ul>
			</td>
		<!--{elseif $order.status eq 20}-->
		<td valign="top" align="center">
			<ul>
				<li>
					<a href="{url app=buyer_returns&order_sn=$order.order_sn}" target="_blank" class="linkbtn">申请退款</a>
				</li>
			</ul>
		</td>
		<!--{else}-->
		<td valign="top" align="center">
                    <!--{if  $gets['type'] eq 'evalua' || $order.status eq 40}-->
			<ul>
				<!--{if $gets['type'] eq 'evalua'}-->
				<li>
					<a href="{url app=buyer_order&act=evaluate&order_id=$order.order_id}" target="_blank" class="subbtnhs btn1 btn">去评价</a>
				</li>
				<!--{/if}-->
                                <!--{if $order.status eq 40 && !$order.close_returns}-->
				<li>
					<a href="{url app=buyer_returns&order_sn=$order.order_sn}" target="_blank" class="linkbtn">申请退款/退货</a>
				</li>
                                <!--{/if}-->
			</ul>
                    <!--{/if}-->
		</td>
		<!--{/if}-->
		<!--{else}-->
		<td width="120" valign="top">&nbsp;</td>
		<td width="90" valign="top">&nbsp;</td>
		<td valign="top" align="center">&nbsp;</td>
		<!--{/if}-->
	</tr>
	<!--{/foreach}-->
</table>
<!--{foreachelse}-->
<div style="padding:20px 0;text-align:center;border:1px solid #cccccc;margin-top:20px;font-weight:bold;">{$lang.no_records}</div>
<!--{/foreach}-->
<iframe name="seller_order" style="display:none;"></iframe>
<div class="goods-page">{include file=goods.page.bottom.html}</div>
</div>
</div>
<script>
  function lxfEndtime(){
          $(".lxftime").each(function(){
                var lxfday=$(this).attr("lxfday");//用来判断是否显示天数的变量
                var endtime = new Date($(this).attr("endtime")).getTime();//取结束日期(毫秒值)
                var nowtime = new Date().getTime();        //今天的日期(毫秒值)
                var youtime = endtime-nowtime;//还有多久(毫秒值)
                var seconds = youtime/1000;
                var minutes = Math.floor(seconds/60);
                var hours = Math.floor(minutes/60);
                var days = Math.floor(hours/24);
                var CDay= days ;
                var CHour= hours % 24;
                var CMinute= minutes % 60;
                var CSecond= Math.floor(seconds%60);//"%"是取余运算，可以理解为60进一后取余数，然后只要余数。
                if(endtime<=nowtime){
							$(this).html("<span><i>0</i></span>时<span><i>0</i></span>分<span><i>0</i></span>秒")//如果结束日期小于当前日期就提示过期啦
							var c_url = $('#order1_action_cancel').attr('url');
							//$.get(c_url,function(data){
								//alert(data.status)
							//});
                        }else{
                                if($(this).attr("lxfday")=="no"){
                                        $(this).html("<span><i>"+CHour+"</i></span>时<span><i>"+CMinute+"</i></span>分<span><i>"+CSecond+"</i></span>秒");          //输出没有天数的数据
                                        }else{
                        $(this).html("<span><i>"+days+"</i></span>天<span><i>"+CHour+"</i></span>时<span><i>"+CMinute+"</i></span>分<span><i>"+CSecond+"</i></span>秒");          //输出有天数的数据
                                }
                        }
          });
   setTimeout("lxfEndtime()",1000);
  };
$(function(){
      lxfEndtime();
	  $('#add_time_from_date').datepicker({
        dateFormat: 'yy-mm-dd'
    });
    $('#add_time_to_date').datepicker({
        dateFormat: 'yy-mm-dd'
    });
   });
</script>
<iframe id='iframe_post' name="iframe_post" src="about:blank" frameborder="0" width="0" height="0"></iframe>
{include file=footer.html}